package org.whh.metadata.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * @Version v1.0
 * @Author Ryan
 * @Date 2021/7/10
 * N-G-P
 */
public final class URLCoder {

    public static String decode(String encoded) {
        try {
            return URLDecoder.decode(encoded, "UTF-8");
        } catch (UnsupportedEncodingException var2) {
            throw new IllegalStateException("Unable to decode URL entry via UTF-8. This should not happen", var2);
        }
    }

    public static String encode(String plain) {
        try {
            return URLEncoder.encode(plain, "UTF-8");
        } catch (UnsupportedEncodingException var2) {
            throw new IllegalStateException("Unable to encode URL entry via UTF-8. This should not happen", var2);
        }
    }

}
